#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["WomanMotion.WebApi.Api/WomanMotion.WebApi.Api.csproj", "WomanMotion.WebApi.Api/"]
COPY ["WomanMotion.WebApi.Identity/WomanMotion.WebApi.Identity.csproj", "WomanMotion.WebApi.Identity/"]
COPY ["WomanMotion.WebApi.Infrastructure/WomanMotion.WebApi.Infrastructure.csproj", "WomanMotion.WebApi.Infrastructure/"]
COPY ["WomanMotion.WebApi.Model/WomanMotion.WebApi.Model.csproj", "WomanMotion.WebApi.Model/"]
COPY ["WomanMotion.WebApi.Service/WomanMotion.WebApi.Service.csproj", "WomanMotion.WebApi.Service/"]
COPY ["WomanMotion.WebApi.Repository/WomanMotion.WebApi.Repository.csproj", "WomanMotion.WebApi.Repository/"]
RUN dotnet restore "WomanMotion.WebApi.Api/WomanMotion.WebApi.Api.csproj"
COPY . .
WORKDIR "/src/WomanMotion.WebApi.Api"
RUN dotnet build "WomanMotion.WebApi.Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "WomanMotion.WebApi.Api.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WomanMotion.WebApi.Api.dll"]